package huawei;

import java.util.Scanner;

public class HJ2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String source = sc.nextLine().toUpperCase();
        char tagger = sc.nextLine().toUpperCase().charAt(0);
        int time = 0;
        for (int i = 0; i < source.length() - 1; i++) {
            if (source.charAt(i) == tagger) {
                time++;
            }
        }
        System.out.print(time);
    }

}
